package site.luojie.netty.rpc.consumer;

import site.luojie.netty.rpc.common.UserService;
import site.luojie.netty.rpc.common.pojo.User;


/**
 * 服务消费者启动主程序类
 *
 * @author jie.luo
 * @since 2020-07-06 23:54
 **/
public class NettyRpcConsumerBootstrap {
    public static void main(String[] args) throws InterruptedException {

        UserService userService = (UserService) RpcConsumer.proxy("127.0.0.1", 8888, UserService.class);

        while (true) {

            User user = new User();
            user.setUserId(111L);
            user.setUserName("哈哈");

            String rpcRequestResult = userService.saveUser(user);
            System.out.println("saveUser: " + rpcRequestResult);


            String result = userService.sayHello("苏坡曼");
            System.out.println("sayHello:" + result);
            Thread.sleep(2000);
        }
    }
}
